The HTTP API > The HTTP API > MMHttp.getText()

 

MMHttp.getText()

Description

Retrieves the contents of the document at the specified URL.

Arguments

URL

The argument is an absolute URL on a Web server; if "http://" is omitted from the URL, it is assumed.

Returns

An object that represents the reply from the server. The data property of this object is a string containing the contents of the document.

Example

The following code gets the contents of a file on a Web server and puts it in a new, untitled Dreamweaver document:

var httpReply = MMHttp.getText("http://www.dreamcentral.com/¬
people/profiles/lori.html");
if (httpReply.statusCode == 200){
	var newDoc =  dw.createDocument();
	newDoc.documentElement.outerHTML = httpReply.data;
}